package service.impl;

import entity.ExperimentData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.ExperimentDataRepository;
import service.ExperimentDataService;

import java.util.List;
@Service
public class ExperimentDataServiceImpl implements ExperimentDataService {

    @Autowired
    private ExperimentDataRepository experimentDataRepository;

    public Integer save(Object o) {
        ExperimentData experimentData = (ExperimentData) o;
        return experimentDataRepository.save(experimentData);
    }

    public List findAll() {
        return experimentDataRepository.findAll();
    }

    public void delete(Integer id) {
        experimentDataRepository.delete(id);
    }

    public Integer update(Object o) {
        ExperimentData experimentData = (ExperimentData) o;
        experimentDataRepository.saveOrUpdate(experimentData);
        return experimentData.getId();
    }
}
